

#import "UIViewController+Navigation.h"
#import "UIImage+Category.h"
#import "NSDate+Category.h"
#import "UIImageView+SD.h"
#import "NSString+Category.h"
#import "UIAlertController+Category.h"
#import "UIScrollView+MJ.h"
#import "UIView+Category.h"
#import "UIButton+Category.h"
#import "UIBarButtonItem+Action.h"
#import "NSObject+Category.h"
#import "UINavigationController+Category.h"
#import "NSMutableArray+Category.h"
#import "UIScrollView+DZNEmpty.h"
#import "UILabel+Category.h"
#import "UITextField+Category.h"
#import "NSDictionary+Category.h"
#import "UITextView+Category.h"
#import "UITableView+Cells.h"


#define KWindow  [UIApplication sharedApplication].delegate.window
#define kScreenSize [UIScreen mainScreen].bounds.size
#define kScreenBounds [UIScreen mainScreen].bounds
#define kScreenWidth [UIScreen mainScreen].bounds.size.width
#define kScreenHeight [UIScreen mainScreen].bounds.size.height

#define kStatusBarSafeHeight _statusHeight()  //状态栏的高度
#define kNavigationHeight (_statusHeight()+44) //导航的高度
#define kBottomSafeHeight (is_X() ? (34) : (0))  //距离底部的安全距离
#define kTabBarHeight (is_X() ? (34+49) : (49)) //tabbar的高度
#define kNavBarHeight kNavigationHeight
#define kStatusBarHeight kStatusBarSafeHeight
#define kTabBarSafetyHeight kTabBarHeight
#define k_TabBar_H kTabBarHeight
#define K_NaviBar_H kNavigationHeight
#define SafeAreaBoHttom_H kBottomSafeHeight
#define SafeStateBar_H kStatusBarHeight


/**判断iphone X*/
static inline BOOL is_X(void){
    BOOL x = NO;
    if (UIDevice.currentDevice.userInterfaceIdiom != UIUserInterfaceIdiomPhone) return x;
    if (@available(iOS 11.0, *)) {
        UIWindow *mainWindow = [[[UIApplication sharedApplication] delegate] window];
        if (mainWindow.safeAreaInsets.bottom > 0.0)  x = YES;
    }
    return x;
}

static inline float _statusHeight(void){
    float height = 20;
    if (@available(iOS 11.0, *)) {
        UIWindow *mainWindow = [[[UIApplication sharedApplication] delegate] window];
        height = mainWindow.safeAreaInsets.top;
    }
    return height;
}
